<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../../css/iuapmobile.um.css">
		<link rel="stylesheet" href="../../css/font-icons.css">
		<link rel="stylesheet" type="text/css" href="../../css/iuapmobile.um.listview.css">
		<link rel="stylesheet" href="../../css/iscroll.css" />
		<script src="../../js/summer.js" ></script>
		<script src="../../js/jquery.min.js" ></script>
		<script src="../../js/iscroll.js"></script>
		<script src="../../js/Frameworks/iuapmobile.frameworks.ui.js" ></script>
		<script type="text/javascript" src="../../js/knockout.js"></script>
		<script type="text/javascript" src="../../js/Frameworks/iuapmobile.frameworks.listview.js"></script>
		<style>
			#select1_dummy, #select2_dummy, #select3_dummy {
				border: none;
				padding-left: 10px;
				color: #555;
				font-size: 17px;
				text-align: right;
				margin-right: 20px;
				width: 100%;
			}
			#select1_dummy:disabled, #select2_dummy:disabled, #select3_dummy:disabled {
				background: #fff;
			}

		</style>

		<style>
			.msg-info {
				position: relative;
			}
			.msg-info .um-badge {
				position: absolute;
				right: -10px;
				font-size: 12px;
			}
			.msg-header {
				width: 40px;
				height: 40px;
				line-height: 40px;
				background: blue;
				border-radius: 50%;
				text-align: center;
				color: white;
			}

		</style>
	</head>
	<body class="f14">
		<div class="um-win" id="installed">
			<div class="um-header">
				<h3>拆机</h3>
				<a href="#" class="um-back back">返回</a>
				<a class="um-header-right" id="submitData" onclick="submitdata();">接受派工</a>
			</div>

			<div class="um-content" ng-app="myApp" ng-controller="myCtrl">
				<ul class="um-list">

					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl15">
								42寸立式三屏:
							</div>
							<div class="um-list-item-right">
								<span ng-model="lssp42c01">{{lssp42c01}}</span>
							</div>
						</div>
					</li>
					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl15">
								43寸立式三屏:
							</div>
							<div class="um-list-item-right">
								<span ng-model="lssp43c01">{{lssp43c01}}</span>
							</div>
						</div>
					</li>
					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl15">
								50寸立式三屏:
							</div>
							<div class="um-list-item-right">
								<span ng-model="lssp50c01">{{lssp50c01}}</span>
							</div>
						</div>
					</li>
					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl15">
								49寸挂式单屏:
							</div>
							<div class="um-list-item-right">
								<span ng-model="gsdp49c01">{{gsdp49c01}}</span>
							</div>
						</div>
					</li>
					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl15">
								43寸挂式单屏:
							</div>
							<div class="um-list-item-right">
								<span ng-model="gsdp43c01">{{gsdp43c01}}</span>
							</div>
						</div>
					</li>
					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl15">
								请扫码填报:
							</div>
							<div class="um-list-item-right">
								<img  id="esn" onclick='scannerCode("esn")' ng-src="../../img/myimg/scanner.png" class="h50 p5"/>
							</div>
						</div>
					</li>
				</ul>
				<div class="um-listview-wrap" id="listview" >
					<ul class="um-list um-no-active" data-bind="foreach: data">
						<li class="um-listview-row" >
							<a href="#" class="um-list-item um-swipe-action um-no-icon">
							<div class="um-list-item-inner">
								<div class="um-list-item-body um-text-overflow f14" style="padding-right:5px;">

									<div class="um-bgc-blue um-white pt5 pb5 ">
										点位号:<span data-bind="text:dwh01"></span>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt5 mb5">
											设备编号:<span data-bind="text:sbbh01"></span>
										</div>
										<div class="um-md-6 w_50 fl mt5 mb5">
											资产编号:<span data-bind="text:zcbh01"></span>
										</div>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt5 mb5">
											商家经营地址:<span data-bind="text:sjjymc01"></span>
										</div>
										<div class="um-md-6 w_50 fl mt5 mb5">
											商家经营名称:<span data-bind="text:sjjydz01"></span>
										</div>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt5 mb5">
											店面负责人:<span data-bind="text:dmfzr01"></span>
										</div>
										<div class="um-md-6 w_50 fl mt5 mb5">
											店面联系方式1:<span data-bind="text:dmlxfs101"></span>
										</div>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt5 mb5">
											拟拆除日期:<span data-bind="text:nccrq01"></span>
										</div>
									</div>
								</div>
							</div> </a>
						</li>
					</ul>
				</div>

			</div>

			<!--<div class="um-footer">

			</div>-->
		</div>
		<script src="../../js/angular.min.js"></script>

		<script>
			var updateList;
			var billid;
			var Pageparams;
			var anscope;
			var datas = new Array();
			var persions = new Array();
			var shangjia = new Array();
			var selectarr = new Array();
			var selectdatas;
			var cleanArr;
			var sbqx;
			var FinshWrite;
			var sfjspg01;
			var sumbitstate = 1;
			$(function() {
				// var curr = new Date().getFullYear();
				var opt = {
					'date' : {
						preset : 'date'
					},
					'select' : {
						preset : 'select'
					}
				};
				$('.select').scroller('destroy').scroller($.extend(opt['select'], {
					theme : "ios7",
					mode : "scroller",
					display : "bottom",
					animate : ""
				}));
			});

			function scannerCode(id) {
				summer.openScanner({
					callback : function(args) {
						var DevideCode = summer.getDeviceInfo().os == "ios" ? args : args.umdcode;
						//$("#" + id).css("display", "none");
						for (var i = 0; i < datas.length; i++) {
							if (DevideCode == datas[i].sbbh01) {
								summer.openWin({
									id : "chaiji",
									url : "html/disassemble/Construction.html",
									pageParam : {
										billid : datas[i].bodyid,
										sumbitstate : sumbitstate,
										itemdata : datas[i],
										sbqx : sbqx,
										type : "scannerCode"
									}
								});
							}
						}
					}
				});
			}

			$(function() {
				var installListindex = 1;
				var installList = [];
				var isChecked;
				var ViewModel = function() {
				};
				var viewModel = new ViewModel();
				//构造控件实例
				var listview = UM.listview("#listview");
				//当前第几页
				viewModel.data = ko.observableArray([]);
				ko.applyBindings(viewModel);
				//绑定叶号，是否第一次bool
				updateList = function() {
					doPost(adressHead.IDisassembleImpl, "appJsCjpgDetail", {
						dataParm : {
							empId : summer.getStorage("userinfo").psnid,
							billid : billid,
							sfjspg01:sfjspg01,
							status : 1
						}
					}, function(data) {
						console.log(data);
						if (data.result == 1) {
							for (var key in data) {
								if (key == "data") {
									if (data.data.length != "") {
										for (var i = 0; i < data.data.length; i++) {
											viewModel.data.push({
												'dwh01' : data.data[i].dwh01,
												'sbbh01' : data.data[i].sbbh01,
												'zcbh01' : data.data[i].zcbh01,
												'sjjymc01' : data.data[i].sjjymc01,
												'sjjydz01' : data.data[i].sjjydz01,
												'dmfzr01' : data.data[i].dmfzr01,
												'dmlxfs101' : data.data[i].dmlxfs101,
												'bodyid':data.data[i].bodyid,
												'nccrq01' : data.data[i].nccrq01.substr(0, 10),
												'check' : false,
												'orderInfo' : data.data[i]
											});

										};
										var list = document.getElementsByName("che");
										//对表单中所有的input进行遍历
										for (var i = 0; i < list.length; i++) {
											//判断是否为文本框
											list[i].addEventListener("click", function(e) {
												console.log(this);
												e.stopPropagation();
											})
										}
										datas = data.data;
										sbqx = data.sbqx;
									} else {
										UM.toast({
											title : '友情提示：',
											text : '没有更多单据',
											duration : 1000
										});
									}
								} else {
									anscope[key] = data[key];
									anscope.$apply();
								}
							}
						} else {
							UM.toast({
								title : '友情提示：',
								text : data.msg,
								duration : 1000
							});
						}
						listview.refresh();
					}, function(err) {
						console.log(err);
					});

				};
				cleanArr = function() {
					try {
						while (viewModel.data.shift()) {
						}
					} catch(e) {
					}
				}
				window.bind = function() {
				    cleanArr();
					updateList();
				};
				//添加控件方法
				listview.on("pullDown", function(sender) {
					try {
						while (viewModel.data.shift()) {
						}
					} catch(e) {
					}
					updateList();
					//viewModel.data.unshift(row);
					sender.refresh();
				});
				/*listview.on("pullUp", function(sender) {
				 updateList(installListindex, 4);
				 sender.refresh();
				 });*/
				listview.on("itemClick", function(sender, args) {
					setTimeout(function() {
						summer.openWin({
							id : "chaiji",
							url : "html/disassemble/Construction.html",
							pageParam : {
								billid : viewModel.data()[args.rowIndex].bodyid,
								sumbitstate : sumbitstate,
								itemdata : viewModel.data()[args.rowIndex].orderInfo,
								sbqx : sbqx,
								type : "itemClick"
							}
						});
					}, 200);
				});
				
			});

			function rebind() {
				window.bind();
			}

			//提交数据
			var submitdatas = new Array();
			function submitdata() {
				submitdatas = [];
				if (datas) {
					for (var i = 0; i < datas.length; i++) {
						submitdatas.push({
							bodyid : datas[i].bodyid,
							billid:billid
						});
					}
				}
				console.log(submitdatas);
				if (submitdatas!="") {
					doPost(adressHead.IDisassembleImpl, "appJsCjpgStatusHx", {
						dataParm : {
							data : submitdatas
						}
					}, function(data) {
						console.log(data);
						if (data.result == 1) {
							UM.toast({
								title : '友情提示：',
								text : data.msg,
								duration : 1000
							});
							sumbitstate = 2;
							//cleanArr();
							//updateList();
						}
					}, function(err) {
						console.log(err);
					});
				}
			}

			function getpk(pkname) {
				for (var i = 0; i < selectdatas.length; i++) {
					if (selectdatas[i].doc_name == pkname) {
						return selectdatas[i].pk_doc;
					}
				}
			}

			/**
			 *angular 控件初始化
			 */
			var app = angular.module('myApp', []);
			app.controller('myCtrl', function($scope, $http) {
				anscope = $scope;
				anscope.persion = ["张三", "李四"];
				//jsons;
				anscope.installer = ["张三", "李四"];
				//jsons;
				//bindqianshou();
			});
			summerready = function() {
				if (summer.pageParam) {
					billid = summer.pageParam.billid;
					sfjspg01 = summer.pageParam.sfjspg01;
					//$("#submitData").css("display","block");
					if(summer.pageParam.isSubmit){
					    $("#submitData").css("display","none");
					    sumbitstate = 2;
					}
					updateList(1, 4);
				}
			}
		</script>

	</body>
</html>
<script type="text/javascript" src="../../js/Myjs/Common.js"></script>